<?php

class freebuyModule extends Module {
	/*
	 * 在构造函数中装载所依赖的类或其他文件
	*/
	function __construct() {
		$this->includePhp('freebuy', 'freebuy');
	}
	
	
	/*
	 * 调用插件资源
	*/
	public function call($user, $method, $param) {
		//检查用户
		switch ($method) {
			case "getView":
				$oid = $param->oid;
				if (!isset($oid)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    freebuy::getView($param);
			    break;
			case "supplementAmount":
				freebuy::supplementAmount($param);
			    break;
			case "refundOrder":
				freebuy::refundOrder($param->id);
			    break;
			case "getFriend":
				freebuy::getFriend($param);
			    break;	
			case "addOrderRefue":
				freebuy::addOrderRefue($param);
			    break;
			case "removeOrderRefue":
				freebuy::removeOrderRefue($param);
			    break;
			case "getRule":
				freebuy::getRule($param);
			    break;
			case "getQrCode":
				$oid = $param->oid;
				if (!isset($oid)) {
					Output::instance()->resultCode(code_lackof_param);
					return;
				}
			    freebuy::getQrCode($param);
			    break;
		}
	}
}


$module = new freebuyModule();
Module::addModule($module);
?>